<div class="col-lg-12">
    <!--当前位置 start-->
    <div class="row">
        <div class="col-lg-12">
            <ol class="breadcrumb">
                <li><i class="fa fa-home mrg-r-sm"></i>首页
                </li>
                <li class="active"><span>接听、拨打录入页面</span>
                </li>
            </ol>
        </div>
    </div>
    <!--当前位置 end-->

    <!--代码写在这里-->
    <div class="row">

        <div class="col-lg-12">
            <div class="main-box">
                <header class="main-box-header clearfix">
                    <h2>接听、拨打录入</h2>
                </header>
                <div class="main-box-body clearfix">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-lg-2 control-label"></label>
                            <div class="col-lg-4">
                                <input type="hidden"  ng-model="calls.code">
                                 <!--
                                                                                          只输入数字
                                 -->
                                <!--<input type="text" id="phone" name="phone" class="form-control" 
                                	ng-model="info.phone" placeholder="请输入电话号码" ng-Keyup="init(info.phone,$event)" 
                                	onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"  >-->
                                 
                                 <input type="text" id="phone" name="phone" class="form-control" 
                                	ng-model="info.phone" placeholder="请输入电话号码"  onkeyup="value=value.replace(/[^\d]/g,'') "
                                     onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />	
                            </div>
                            <a ng-disabled="callStatus" ng-class="{'no': 'btn btn-default', 'ok': 'btn btn-success'}[btn_status]"   ng-click="answer(info)">接听</a>
                            <a ng-disabled="callStatus" ng-class="{'no': 'btn btn-default', 'ok': 'btn btn-success'}[btn_status]" ng-click="ring(info)">拨打</a>
                            <a class="btn btn-danger" ng-click="hangup(info,calls)" id="hangup" >挂断</a>
                        </div>
                        <div class="form-group" ng-show="af">
                            <label class="col-lg-2 control-label">会员卡号</label>
                            <div class="col-lg-5">
                            	<select  class="form-control" ng-model="info.card_number" ng-change="searchs(info)"   ng-options="inf.card_number as inf.card_number for inf in infoList" >
                            		<option value="">请选择</option>
								</select>
								<!--<input type="text" class="form-control" id="card_number" ng-model="info.card_number"  placeholder="请输入会员卡号">-->
                            </div>
                            <button class="btn btn-success" id="addCard">新增会员卡</button>
                            <span>该卡余额：{{thisCardFund}}元</span>
                        </div>
                        <div class="form-group" style="display: none;" id="card">
                            <label class="col-lg-2 control-label"></label>
                            <div class="col-lg-5">
                               <input type="text" class="form-control" id="card_number" ng-model="info.card_number"  placeholder="请输入八位数的会员卡号">
                            </div>
                            	<a class="btn btn-success"  ng-click="addCard(info)">确定</a>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">客户姓名</label>
                            <div class="col-lg-6">
                                <input type="text" class="form-control" id="name" readonly="readonly" ng-model="infos.name">
                                <input type="hidden" ng-model="info.code">
                            </div>
                        </div>
                        <div class="form-group">
							<label class="col-lg-2 control-label">行政区</label>
							<div class="col-lg-6">
								<input type="text" class="form-control"  ng-model="infos.xingzheng" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label class="col-lg-2 control-label">街道</label>
							<div class="col-lg-6">
								<input type="text" class="form-control"  ng-model="infos.jiedao" readonly="readonly">
							</div>
						</div>
						<div class="form-group">
							<label class="col-lg-2 control-label">社区</label>
							<div class="col-lg-6">
								<input type="text" class="form-control"  ng-model="infos.shequ" readonly="readonly">
							</div>
						</div>
                        <div class="form-group">
							<label class="col-lg-2 control-label">联系地址</label>
							<div class="col-lg-6">
								<input type="text" class="form-control" id="address" ng-model="infos.address" placeholder="请输入联系地址">
							</div>
						</div>
                        <div class="form-group">
							<label class="col-lg-2 control-label">联系方式</label>
							<div class="col-lg-6">
								<input type="text" class="form-control" id="contact_phone" ng-model="infos.contact_phone" placeholder="请输入联系方式">
							</div>
						</div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">服务类型</label>
                            <div class="col-lg-6">
                                <div class="radio checkbox-inline">
                                    <input type="radio" name="optionsRadios" id="zixun" value="咨询" ng-model="info.service">
                                    <label for="zixun">咨询</label>
                                </div>
                                <div class="radio checkbox-inline">
                                    <input type="radio" name="optionsRadios" id="tousu" value="投诉" ng-model="info.service">
                                    <label for="tousu">投诉</label>
                                </div>
                                <div class="radio checkbox-inline">
                                    <input type="radio" name="optionsRadios" id="fuwu" checked  value="服务办理" ng-model="info.service" >
                                    <label for="fuwu">服务办理</label>
                                </div>
                            </div>
                        </div>
                        <div id="range-ul" style="display: none;">
							<div class="form-group">
								<label class="col-lg-2 control-label">预约时间</label>
								<div class="col-lg-6">
									<input type="text" class="form-control" id="time"  ng-model="time"  placeholder="请输入预约时间" >
								</div>
							</div>

							<div class="form-group">
								<label class="col-lg-2 control-label">选择服务类型</label>
								<div class="col-lg-2">
									<input type="text" class="form-control" readonly="readonly"   value="养老服务">
						        </div>
						        <div class="col-lg-2">
							        <select class="form-control"  ng-model="info.serviceType2" ng-change="getserviceType3(info.serviceType2.code)"   ng-options=" service2 as service2.title for service2 in serviceList2" >
										<option value="">请选择服务项目</option>
									</select>
						        </div>
						     	<div class="col-lg-2">
							        <select class="form-control"  ng-model="info.serviceType3" ng-change="getMoneyList(info.serviceType3.code)"  ng-options=" service3 as service3.title for service3 in serviceList3" >
										<option value="">请选择服务项目</option>
									</select>
						        </div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label">指定服务商</label>
								<div class="col-lg-4">
							        <select class="form-control"  ng-model="info.company_code"  ng-change="getCompanyName(info.company_code.code)" ng-options="st as st.name for st in companylist ">
										<option value="" >请选择服务商{{st.name}}</option>
									</select>
						        </div>
						        <div class="col-lg-2" style="display: none;">
							        <select class="form-control"  id="companyName" ng-model="info.groupName"   ng-options="companyName.groupName for companyName in companyNameList"  >
										<option value="">请选择服务站</option>
									</select>
						        </div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label">服务金额</label>
								<div class="col-lg-6">
									<select class="form-control" ng-model="info.money"  id="moneys" ng-options="moneys as moneys.text for moneys in moneyList" >
                                        <option value="">请选择服务金额</option>
									</select>
								</div>
							</div>
						</div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">备注</label>
                            <div class="col-lg-6">
                                <textarea class="form-control" id="exampleTextarea" rows="3" ng-model="info.remark"></textarea>
                                <input type="hidden" ng-model="info.code">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-lg-offset-2 col-lg-offset-7">
                                <a class="btn btn-success" ng-disabled="myStyle" ng-click="update(info,infos,calls)" ng-if="info.service != '服务办理'">保存</a>
                                <a class="btn btn-success" ng-disabled="myStyle" ng-click="updates(info,infos,calls)" ng-if="info.service == '服务办理'">保存</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    
    
    
    
    <div class="row">
		<div class="col-lg-12">
			<div class="main-box clearfix">
				<div class="main-box-body clearfix">
					<div class="tabs-wrapper">
						<ul class="nav nav-tabs">
							<li><a id="tab-home1" data-toggle="tab">来电历史</a></li>
							<li><a id="tab-help1" data-toggle="tab" ng-click="searchOrder(info)">订单历史</a></li>
							<li class="active"><a id="tab-xiaofei1" data-toggle="tab"  ng-click="searchCard(info)">消费记录</a></li>
						</ul>
						<div class="tab-content">
							<div class="tab-pane fade in active" id="tab-home" style="display: none;" >
								<div class="table-responsive">
									<table class="table table-hover table-striped text-center">
										<thead >
											<tr>
												<th class="text-center"><span>来电号码</span></th>
												<th class="text-center"><span>服务类型</span></th>
												<th class="text-center"><span>通话类型</span></th>
												<th class="text-center"><span>接通时间</span></th>
												<th class="text-center"><span>挂断时间</span></th>
												<th class="text-center"><span>备注/短信</span></th>
											</tr>
										</thead>
										<tbody >
											<tr role="row" class="odd"  ng-repeat="item in lists" id="{{item.order_id}}" >
												<td class="sorting_1">{{item.phone}}</td>
												<td class="sorting_1">{{item.service}}</td>
												<td>{{item.status}}</td>
												<td>{{item.start_time}}</td>
												<td>{{item.end_time}}</td>
												<td>{{item.remark}}</td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
							<div class="tab-pane fade in active" id="tab-help" style="display: none;" >
								<div class="table-responsive">
									<table class="table table-hover table-striped text-center">
										<thead >
											<tr>
												<th class="text-center"><span>订单号</span></th>
                                                <th class="text-center"><span>姓名</span></th>
                                                <th class="text-center"><span>会员卡号</span></th>
												<th class="text-center"><span>服务项目</span></th>
												<th class="text-center"><span>下单时间</span></th>
												<th class="text-center"><span>订单状态</span></th>
												<th class="text-center"><span>当前服务人员</span></th>
												<th class="text-center"><span>操作</span></th>
											</tr>
										</thead>
										<tbody >
											<tr role="row" class="odd"  ng-repeat="item in list" id="{{item._id}}" >
												<td class="sorting_1">{{item.order_id}}</td>
                                                <td class="sorting_1">{{item.name}}</td>
                                                <td class="sorting_1">{{item.card_number}}</td>
												<td>{{item.serviceType3_title}}</td>
												<td>{{item.create_time}}</td>
												<td>{{item.status}}</td>
												<td>{{item.servant_name}}</td>
												<td>[<a href="javascript:void(0)" class="md-trigger" data-modal="modal" ng-click="showDetailPopup(item)">详情</a>]</td>
											</tr>
										</tbody>
									</table>
								</div>
							</div>
							<div class="tab-pane fade in active" id="tab-xiaofei">
								<div class="table-responsive">
									<table class="table table-hover table-striped text-center">
										<thead >
											<tr>
												<th class="text-center"><span>会员卡号</span></th>
												<th class="text-center"><span>服务时间</span></th>
												<th class="text-center"><span>服务内容</span></th>
                                                <th class="text-center"><span>消费金额</span></th>
												<th class="text-center"><span>交易类型</span></th>
												<th class="text-center"><span>余额</span></th>

											</tr>
										</thead>
										<tbody >
											<tr role="row" class="odd" ng-repeat="item in items" id="{{item._id}}">
												<td class="sorting_1">{{item.card_id}}</td>
                                                <td>{{item.create_time}}</td>
                                                <td>{{item.description}}</td>
                                                <td>{{item.fund}}</td>
												<td>{{item.type}}</td>
												<td>{{item.final_fund}}</td>

											</tr>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
$(document).ready(function(){
	$("#addCard").click(function(){
		$("#card").toggle();
	});
	$("#zixun").click(function(){
		$("#range-ul").hide();
	});
	$("#tousu").click(function(){
		$("#range-ul").hide();
	});
    $("#fuwu").click(function(){
        $("#range-ul").show();
//      laydate(time);
    });
    
    $("#hangup").click(function(){
        $("#range-ul").hide();
        $("#fuwu").removeAttr("checked");
    });
    
    
    $("#tab-home1").click(function(){
        $("#tab-home").show();
        $("#tab-help").hide();
        $("#tab-xiaofei").hide();
    });
    
     $("#tab-help1").click(function(){
        $("#tab-help").show();
        $("#tab-home").hide();
        $("#tab-xiaofei").hide();
    });
    $("#tab-xiaofei1").click(function(){
        $("#tab-xiaofei").show();
        $("#tab-home").hide();
        $("#tab-help").hide();
    });
    $("#time").click(function(){
    	 laydate(time);
    });
});

</script>
<script>
var time= {
    elem: '#time',
    format: 'YYYY-MM-DD hh:mm:ss',
    min: laydate.now(), //设定最小日期为当前日期
    max: '2099-06-16 23:59:59', //最大日期
    istime: true,
    istoday: false,
    choose: function(datas){
         end.min = datas; //开始日选好后，重置结束日的最小日期
         end.time = datas //将结束日的初始值设定为开始日
    }
};

</script>

<!--这是弹出框-->
<style>
	.modal-backdrop {
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
	}
	.modal-dialog {
		margin-top: 15%;
	}
</style>
<div class="modal fade" id="back-order-dialog" role="dialog" aria-labelledby="gridSystemModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
				<h4 class="modal-title" id="gridSystemModalLabel">订单详情</h4>
			</div>
			<div class="modal-body">
				<div class="container-fluid">

                        <!--<div class="form-group">
                            <label for="back-order-reason">终止订单\退单原因</label>
                            <input type="text" class="form-control" id="back-order-reason" value="" autofocus="autofocus" ng-model="reason">
                        </div>-->
                    <div class="form-group">
                        <label class=" control-label">订单号</label>
                        <input type="text" class="form-control" ng-model="orderDetail.order_id" readonly="readonly">
                    </div>
                    <div class="form-group">
                        <label class=" control-label">会员卡号</label>
                        <input type="text" class="form-control" ng-model="orderDetail.card_number" readonly="readonly">
                    </div>
                    <div class="form-group">
                        <label class=" control-label">联系人</label>
                        <input type="text" class="form-control" ng-model="orderDetail.name" readonly="readonly">
                    </div>
                    <div class="form-group">
                        <label class=" control-label">联系电话</label>
                        <input type="text" class="form-control" ng-model="orderDetail.phone" readonly="readonly">
                    </div>
                    <div class="form-group">
                        <label class=" control-label">联系地址</label>
                        <input type="text" class="form-control" ng-model="orderDetail.address" readonly="readonly">

                    </div>
                    <div class="form-group">
                        <label class=" control-label">预约时间</label>
                        <input type="text" class="form-control" ng-model="orderDetail.time" readonly="readonly">

                    </div>
                    <div class="form-group">
                        <label class=" control-label">下单时间</label>
                        <input type="text" class="form-control" ng-model="orderDetail.create_time" readonly="readonly">
                    </div>
                    <div class="form-group">
                        <label class=" control-label">服务项目</label>
                        <input type="text" class="form-control" ng-model="orderDetail.serviceType1_title" readonly="readonly">
                    </div>
                    <div class="form-group" ng-if="order.settlement_status=='1'">
                        <label class=" control-label">订单金额(元)</label>
                        <input type="text" class="form-control" ng-model="orderDetail.settlement_total" readonly="readonly">
                    </div>
                    <div class="form-group">
                        <label class=" control-label">订单状态</label>
                        <input type="text" class="form-control" ng-model="orderDetail.status" readonly="readonly">
                    </div>
                    <div class="form-group" ng-if="order.status=='终止订单'">
                        <label class=" control-label">终止订单原因</label>
                        <input type="text" class="form-control" disabled  value="" ng-model="orderDetail.reason"/>
                    </div>
                    <div class="form-group">
                        <label class=" control-label">订单详情</label>
                        <input type="text" class="form-control" ng-model="orderDetail.detail" readonly="readonly">
                    </div>
                    <div class="form-group" >
                        <label class=" control-label">当前服务商</label>
                        <input type="text" class="form-control" disabled value="" ng-model="orderDetail.selected_company_name"/>
                    </div>

                    <div class="form-group" >
                        <label class=" control-label">当前服务商电话</label>
                        <input type="text" class="form-control" disabled value="" ng-model="orderDetail.selected_company_phone"/>
                    </div>
                    <div class="form-group" ng-if=" order.selected_company_code == '12349E' ">
                        <label class=" control-label">当前服务站</label>
                        <input type="text" class="form-control" disabled value="" ng-model="orderDetail.selected_manager_group_name"/>
                    </div>
                    <div class="form-group" >
                        <label class=" control-label">当前服务人员</label>
                        <input type="text" class="form-control" disabled value="" ng-model="orderDetail.selected_servant_name"/>
                    </div>
                    <div class="form-group" >
                        <label class="control-label">当前服务人员电话</label>
                        <input type="text" class="form-control" disabled value="" ng-model="orderDetail.selected_servant_phone"/>
                    </div>
				</div>
			</div>
		</div>
	</div>
</div>

<!--命令-->
<!--<script>-->
	<!--$("#back-order-dialog").modal('show');-->
<!--</script>-->